<?php
class WarehouseVo extends SzAbstractMySqlVo
{

    private $userId;
    private $warehouseId;
    private $decorId;
    private $stock;

    /**
     * Initialize WarehouseVo.
     *
     * @param $userId
     * @param $warehouseId
     * @param $decorId
     * @param $stock
     * @param boolean $isInsert default false, means for now this vo is initialized not for insert process
     * @return WarehouseVo
     */
    public function __construct($userId, $warehouseId, $decorId, $stock, $isInsert = false) {
        $this->userId = $userId;
        $this->warehouseId = $warehouseId;
        $this->decorId = $decorId;
        $this->stock = $stock;

        $this->isInsert = $isInsert;
        $this->voClassName = 'WarehouseVo';
        $this->ormName = 'Warehouse';
    }

    /**
     * @see SzAbstractVo::toArray
     */
    public function toArray($needEncode = false)
    {
        return array(
            'userId' => $this->getUserId(),
            'warehouseId' => $this->getWarehouseId(),
            'decorId' => $this->getDecorId(),
            'stock' => $this->getStock(),
        );
    }

    /**
     * @see SzAbstractVo::toEntireArray
     */
    public function toEntireArray($needEncode = false)
    {
        return array(
            'userId' => $this->getUserId(),
            'warehouseId' => $this->getWarehouseId(),
            'decorId' => $this->getDecorId(),
            'stock' => $this->getStock(),
        );
    }

    /**
     * @see SzAbstractVo::toPureArray
     */
    public function toPureArray()
    {
        return array(
            $this->getUserId(),
            $this->getWarehouseId(),
            $this->getDecorId(),
            $this->getStock(),
        );
    }

    public function getUserId()
    {
        return $this->userId;
    }

    public function setUserId($val)
    {
        $this->saveColumnStatus(0, $this->userId);
        $this->userId = $val;
    }

    public function getWarehouseId()
    {
        return $this->warehouseId;
    }

    public function setWarehouseId($val)
    {
        $this->saveColumnStatus(1, $this->warehouseId);
        $this->warehouseId = $val;
    }

    public function getDecorId()
    {
        return $this->decorId;
    }

    public function setDecorId($val)
    {
        $this->saveColumnStatus(2, $this->decorId);
        $this->decorId = $val;
    }

    public function getStock()
    {
        return $this->stock;
    }

    public function setStock($val)
    {
        $this->saveColumnStatus(3, $this->stock);
        $this->stock = $val;
    }

    public function updateStock($val)
    {
        $this->setStock($this->stock + $val);
    }

}